//
// CShadowMap.java
// Copyright (C) 2010  "Naush" <naush _ hotmail _ fr>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>./* ----------------------------------------------------------------------------







package org.ryzom.nel.threed;

import org.ryzom.nel.misc.CVector;

public class CShadowMap {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public CShadowMap(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(CShadowMap obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nel3dJNI.delete_CShadowMap(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public void setLocalProjectionMatrix(SWIGTYPE_p_NLMISC__CMatrix value) {
    nel3dJNI.CShadowMap_LocalProjectionMatrix_set(swigCPtr, this, SWIGTYPE_p_NLMISC__CMatrix.getCPtr(value));
  }

  public SWIGTYPE_p_NLMISC__CMatrix getLocalProjectionMatrix() {
    long cPtr = nel3dJNI.CShadowMap_LocalProjectionMatrix_get(swigCPtr, this);
    return (cPtr == 0) ? null : new SWIGTYPE_p_NLMISC__CMatrix(cPtr, false);
  }

  public void setLocalClipPlanes(SWIGTYPE_p_std__vectorT_NLMISC__CPlane_t value) {
    nel3dJNI.CShadowMap_LocalClipPlanes_set(swigCPtr, this, SWIGTYPE_p_std__vectorT_NLMISC__CPlane_t.getCPtr(value));
  }

  public SWIGTYPE_p_std__vectorT_NLMISC__CPlane_t getLocalClipPlanes() {
    long cPtr = nel3dJNI.CShadowMap_LocalClipPlanes_get(swigCPtr, this);
    return (cPtr == 0) ? null : new SWIGTYPE_p_std__vectorT_NLMISC__CPlane_t(cPtr, false);
  }

  public void setLocalBoundingBox(SWIGTYPE_p_NLMISC__CAABBox value) {
    nel3dJNI.CShadowMap_LocalBoundingBox_set(swigCPtr, this, SWIGTYPE_p_NLMISC__CAABBox.getCPtr(value));
  }

  public SWIGTYPE_p_NLMISC__CAABBox getLocalBoundingBox() {
    long cPtr = nel3dJNI.CShadowMap_LocalBoundingBox_get(swigCPtr, this);
    return (cPtr == 0) ? null : new SWIGTYPE_p_NLMISC__CAABBox(cPtr, false);
  }

  public void setLastGenerationFrame(java.math.BigInteger value) {
    nel3dJNI.CShadowMap_LastGenerationFrame_set(swigCPtr, this, value);
  }

  public java.math.BigInteger getLastGenerationFrame() {
    return nel3dJNI.CShadowMap_LastGenerationFrame_get(swigCPtr, this);
  }

  public void setDistanceFade(float value) {
    nel3dJNI.CShadowMap_DistanceFade_set(swigCPtr, this, value);
  }

  public float getDistanceFade() {
    return nel3dJNI.CShadowMap_DistanceFade_get(swigCPtr, this);
  }

  public void setTemporalOutScreenFade(float value) {
    nel3dJNI.CShadowMap_TemporalOutScreenFade_set(swigCPtr, this, value);
  }

  public float getTemporalOutScreenFade() {
    return nel3dJNI.CShadowMap_TemporalOutScreenFade_get(swigCPtr, this);
  }

  public void setTemporalInScreenFade(float value) {
    nel3dJNI.CShadowMap_TemporalInScreenFade_set(swigCPtr, this, value);
  }

  public float getTemporalInScreenFade() {
    return nel3dJNI.CShadowMap_TemporalInScreenFade_get(swigCPtr, this);
  }

  public void setInScreenFadeAccum(float value) {
    nel3dJNI.CShadowMap_InScreenFadeAccum_set(swigCPtr, this, value);
  }

  public float getInScreenFadeAccum() {
    return nel3dJNI.CShadowMap_InScreenFadeAccum_get(swigCPtr, this);
  }

  public CShadowMap(CShadowMapManager smm) {
    this(nel3dJNI.new_CShadowMap(CShadowMapManager.getCPtr(smm), smm), true);
  }

  public void initTexture(long textSize) {
    nel3dJNI.CShadowMap_initTexture(swigCPtr, this, textSize);
  }

  public void resetTexture() {
    nel3dJNI.CShadowMap_resetTexture(swigCPtr, this);
  }

  public long getTextureSize() {
    return nel3dJNI.CShadowMap_getTextureSize(swigCPtr, this);
  }

  public ITexture getTexture() {
    long cPtr = nel3dJNI.CShadowMap_getTexture(swigCPtr, this);
    return (cPtr == 0) ? null : new ITexture(cPtr, false);
  }

  public void buildCasterCameraMatrix(CVector lightDir, SWIGTYPE_p_NLMISC__CMatrix localPosMatrix, SWIGTYPE_p_NLMISC__CAABBox bbShape, SWIGTYPE_p_NLMISC__CMatrix cameraMatrix) {
    nel3dJNI.CShadowMap_buildCasterCameraMatrix(swigCPtr, this, CVector.getCPtr(lightDir), lightDir, SWIGTYPE_p_NLMISC__CMatrix.getCPtr(localPosMatrix), SWIGTYPE_p_NLMISC__CAABBox.getCPtr(bbShape), SWIGTYPE_p_NLMISC__CMatrix.getCPtr(cameraMatrix));
  }

  public void buildProjectionInfos(SWIGTYPE_p_NLMISC__CMatrix cameraMatrix, CVector backPoint, float shadowMaxDepth) {
    nel3dJNI.CShadowMap_buildProjectionInfos(swigCPtr, this, SWIGTYPE_p_NLMISC__CMatrix.getCPtr(cameraMatrix), CVector.getCPtr(backPoint), backPoint, shadowMaxDepth);
  }

  public void buildClipInfoFromMatrix() {
    nel3dJNI.CShadowMap_buildClipInfoFromMatrix(swigCPtr, this);
  }

  public void processFades() {
    nel3dJNI.CShadowMap_processFades(swigCPtr, this);
  }

  public float getFadeAround() {
    return nel3dJNI.CShadowMap_getFadeAround(swigCPtr, this);
  }

  public float getFinalFade() {
    return nel3dJNI.CShadowMap_getFinalFade(swigCPtr, this);
  }

}
